﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Test
{
    public partial class Form1 : Form
    {
        OpenFileDialog dlg = new OpenFileDialog();
        Process pr = new Process();
        List<string> input = new List<string>();
        DataTable NV = new DataTable();
        Excel ex = new Excel();
       
        public Form1()
        {
            InitializeComponent();
        }

        private void btn_Load_Click(object sender, EventArgs e)
        {
            dlg.Filter = "txt Files|*.txt|All Files|*.*";
            if(dlg.ShowDialog()==DialogResult.OK)
            {
                tbName.Text = dlg.FileName.ToString();
                input=pr.ReadText(dlg.FileName);
                

            }
        }

        private void btn_save_Click(object sender, EventArgs e)
        {
            if(dlg.FileName!=null)
            {
                input = pr.ReadText(dlg.FileName);
                NV = pr.ExportArrToTable(pr.ConvertListToArr(input));
                ex.ExportToExcel(NV);
            }
        }
    }
}
